home *** CD-ROM | disk | FTP | other *** search
- /*
- File: DebugStream.h
-
- Copyright: © 1991-1994 by Apple Computer, Inc.
- All rights reserved.
-
- Part of the AOCE Sample SMSAM Package. Consult the license
- which came with this software for your specific legal rights.
-
- */
-
-
-
- #ifndef __DEBUGSTREAM__
- #define __DEBUGSTREAM__
-
- #ifndef __TYPES__
- #include <Types.h>
- #endif
-
- //#ifndef __STREAM__
- //#include <Stream.h>
- //#endif
-
- #ifndef __IOSTREAM__
- #include <iostream.h>
- #endif
-
- #pragma push
- #pragma segment DebugStream
-
- /***********************************|****************************************/
-
- class debugstream : public ostream
- {
- public:
- debugstream(streambuf*);
- virtual ~debugstream();
-
- debugstream& write ( const char*, int );
-
- debugstream& operator<< (char c) { put(c); osfx(); return *this; };
- debugstream& operator<< (short c) { return (debugstream&) ostream::operator << ( (int) c ); };
- debugstream& operator<< (int c) { return (debugstream&) ostream::operator << ( (int) c ); };
- debugstream& operator<< (long c) { return (debugstream&) ostream::operator << ( (int) c ); };
-
- debugstream& operator<< (unsigned char c) { put(c); osfx(); return *this; };
- debugstream& operator<< (unsigned short c) { return (debugstream&) ostream::operator << ( (unsigned int) c ); };
- debugstream& operator<< (unsigned int c) { return (debugstream&) ostream::operator << ( (unsigned int) c ); };
- debugstream& operator<< (unsigned long c) { return (debugstream&) ostream::operator << ( (unsigned int) c ); };
-
- debugstream& operator<< (const char* s) { return (debugstream&) ostream::operator << ( s ); };
- debugstream& operator<< (const unsigned char* s) { return debugstream::write ( (char*) s + 1, (int) s [ 0 ] ); };
- debugstream& operator<< (const void* p) { return (debugstream&) ostream::operator << ( (void*) p ); };
-
- debugstream& operator<< (ostream& (*f)(ostream&)) { return (debugstream&) (*f)(*this); }
-
- void SetEncodedOutput (Boolean newValue);
-
- private: Boolean fEncodedCharacterOutput;
- };
-
- /***********************************|****************************************/
-
- class TWWStreamBuf : public streambuf
- {
- public: TWWStreamBuf ();
- virtual ~TWWStreamBuf();
-
- virtual int overflow(int c = EOF);
- virtual int underflow ();
-
- virtual int sync();
- };
-
- /***********************************|****************************************/
-
- ostream& date (ostream&); // put the date (short format) into the output stream
- ostream& time (ostream&); // put the time into the output stream
- ostream& version (ostream&); // put the program version
- ostream& encoded (ostream&); // makes the next item output in an encoded character format
- inline ostream& deco (ostream& s) { s.setf(ios::dec, ios::basefield); return s; };
- inline ostream& hexo (ostream& s) { s.setf(ios::hex, ios::basefield); return s; };
- inline ostream& octo (ostream& s) { s.setf(ios::oct, ios::basefield); return s; };
-
- inline ostream& operator<< (ostream& s, const StringPtr str) { return s.write ( (char *) &str[1], str[0]); };
- inline ostream& OutputOSType (ostream& s, OSType type) { return s.write((const char*) &type, sizeof(type)); };
-
- /***********************************|****************************************/
-
- #pragma pop
-
- #endif // __DEBUGSTREAM__
-